1. Field of the Invention
The present invention relates to a data separating circuit, and more particularly to a data separating method and data separating circuit, in which a desired section of a desired transport packet is cut out from a MPEG2 transport packet stream defined by the motion picture coding expert group (MPEG2) of the International Standardization Organization (ISO).
2. Description of the Related Art
In an MPEG2 transport packet (TS) stream, a method of transmitting program specific information (hereinafter, to be referred to as PSI) is described in ISO/IEC 13818.1. Here, the method will be described here in brief.
As shown in FIG. 3A, transport packets which have different packet identifiers (PIDs) are multiplexed with respect to time to produce a transport packet stream. Each of the transport packets has the fixed data length of 188 bytes. When the program specific information (PSI) is transmitted in the transport packet stream, the program specific information is divided into sections and is inserted in a transport packet payload section in a transport packet, as shown in FIGS. 3B and 3C. The section is a data packet with an optional length of 4094 bytes in maximum. However, the sections are not always arranged in units of payload sections in the transport packet. There is a case that a plurality of sections exists in the transport packet payload section. The transport packet input rate is generally very high.
The transport packet separating circuit extracts a desired transport packet, specifically only a desired section data which is contained in the extracted transport packet to reduce the capacity of a memory provided of the subsequent stage.
In the method of extracting, only the transport packet is extracted which has the same packet identifier (PID) of 13 bits as a reference packet identifier in the header section. Then, the leading n bytes of the section of the extracted transport packet is compared with a reference data of n bytes by use of a mask data of n bytes. When both are coincident with each other, the section is transferred to the memory of the subsequent stage.
The structure of a conventional MPEG2 transport packet stream separating circuit is shown in FIG. 1. The conventional MPEG2 transport packet stream separating circuit is composed of a packet identifier (PID) filter 1, a section filter unit 22, and a RAM interface (RAMIF) unit 32. The packet identifier filter 1 compares a packet identifier of the transport packet with a reference packet identifier and extracts only the transport packet which has the same packet identifier as the reference packet identifier. The section filter unit 22 detects coincidence or discrepancy between the leading n bytes of the extracted section and a reference data of n bytes by use of a mask data of n bytes. The RAMIF unit 32 generates a write address to the following stage of RAM and a writing signal to the RAM.
The section filter unit 22 is composed of a section start detecting unit 4 for detecting the head portion of the section, a comparator 5, a reference register 6, a mask register 7 and a stack buffer 18. Also, the RAMIF section 32 is composed of a RAMIF signal generating unit 8, a data latch 9, and an address generating unit 19. Also, as show in FIG. 2, the address generating unit 19 is composed of an address register 20 and an incrementer 15.
Next, an operation of this transport packet separating circuit will be described.
The packet identifier filter extracts only transport packet, which has a specific packet identifier, from an inputted transport packet stream, and outputs to the section filter unit 22 of the subsequent stage with the packet identifier. The section start detecting unit 4 of the section filter unit 22 detects the head of the sections of the extracted transport packet, and notifies to the comparator 5 of the subsequent stage by use of a start signal. The comparator 5 compares the leading n bytes of the extracted section and the reference data stored in the reference register 6, and outputs only an coincident portion to the RAMIF section 3 of the subsequent stage. In this case, the n byte data can be masked by use of the mask data stored in the mask register 7 in units of bits.
The RAMIF section 3 of the subsequent stage has the function to write the extracted transport packet in s specific area of the following stage of RAM. The address generating unit 19 is provided for every PID and has an address register 20 which stores the next address to an address where data is last written. The address generating unit 19 selects the address register 20 based on the packet identifier of the transport packet which has been extracted by the section filter unit 2 of the front stage. Also, the RAMIF section 32 writes the data latched by the data latch in the RAM area which is indicated with the address which is incremented by the incrementer 15 each time byte data arrives. In this case, the write signal which is generated by the RAMIF signal generating unit 8 is outputted and the incremented address is set in the address register 20.
As show in FIG. 4, there is a case where the n bytes of the header portion of the section as a comparison object are not contained in a single transport packet (TS packet #2). In other words, the n bytes extend over the transport packet (TS packet #0) and the transport packet (TS packet #2) which have the same packet identifier, because of division of the n bytes at a middle point. In this case, since the section filter unit 2 can not determine coincidence or discrepancy between the n bytes and the reference data, the n bytes are not possible to be outputted to the subsequent stage of RAMIF unit 32. Therefore, the data which is coincident with the reference data to the middle point is necessary to be stored until the subsequent transport packet having the same packet identifier arrives. Thus, the conventional section filter unit 2 needs to be provided with the stack buffer 18 of n bytes for every packet identifier. For example, when 32 kinds of section filter is present and the filtering of 8-byte length is performed in each of the 32 kinds of section filter, the buffer for 256 bytes (=32*8) is required to be provided in the section filter unit 2.
However, in the conventional transport packet stream separating circuit, there is the following problem. That is, it is necessary for the conventional section filter unit 22 to be provided with the stack buffer of n bytes for every PID, when n bytes of the header portion of the section as the comparison object are not contained In a single transport packet but extend over the transport packets which have the same packet identifier.
The reason is that the section filter unit 22 can not output the section as the comparative object to the subsequent stage as in the above case, until coincidence or discrepancy is determined. As a result, the data which is subjected to the coincidence determination to the middle point need to be stored in the section filter unit 22 until the subsequent transport packet arrives.